Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(wip) Update: docs/source/user_guide/hpo.rst #410

Merged
merged 5 commits into from
Jan 20, 2025

Conversation

aramoto99
Copy link
Collaborator

docs/source/user_guide/hpo.rst のたたき台を作成

@aramoto99 aramoto99 requested a review from yoshipon December 19, 2024 03:39
@aramoto99
Copy link
Collaborator Author

hpo/optimize.pyの再設計に関して。

hpo.rst にて大きく変更した記述を以下に抜粋します。
設計段階のためコードは未変更です。

executorのinstantiate化

excutorの指定をconfigで指定するように変更。→ local と abci で使用感の統一

設定ファイルでの指定例:

ローカル実行の場合

  • config.yaml
executor:
  _target_: aiaccel.hpo.job_executors.LocalJobExecutor
  n_max_jobs: 4

ABCI実行の場合

  • config.yaml
executor:
  _target_: aiaccel.hpo.job_executors.AbciJobExecutor
  n_max_jobs: 4
  group: gaa50000

groupのようなABCI特有の設定の指定はexecutorで指定します


出力フォーマット・出力先の指定について

excutorと同じく、instantiateを使用する形に変更しました。
デフォルトをJSONとし、Pickle、標準出力など他の形式にも対応可能。
設定項目名は resultとしております。また、出力先ファイル名のテンプレートを、この項目にて設定するように変更しました。

設定とobjective.pyの対応

JSON形式(デフォルト)の場合:

  • config
result:
  _target_: aiaccel.results.JsonResult
  filename_template: "{job.cwd}/{job.job_name}_result.json"
  • objective.py
import json

def main() -> None:
 # ... argument parsing ...
 y = (x1**2) - (4.0 * x1) + (x2**2) - x2 - (x1 * x2)
 with open(args.dst_filename, 'w') as f:
   json.dump(y, f)  # json 形式で保存

Pickle 形式の場合

  • config
result:
  _target_: aiaccel.results.PickleResult
  filename_template: "{job.cwd}/{job.job_name}_result.pkl"
  • objective.py
import pickle

def main() -> None:
  # ... argument parsing ...
  y = (x1**2) - (4.0 * x1) + (x2**2) - x2 - (x1 * x2)
  with open(args.dst_filename, 'wb') as f:
    pickle.dump(y, f)  # Picke 形式で保存

標準出力形式の場合

  • config
result:
  _target_: aiaccel.results.StdoutResult
  filename_template: "{job.cwd}/{job.job_name}_result.txt"
  • objective.py
def main() -> None:
  # ... argument parsing ...
  y = (x1**2) - (4.0 * x1) + (x2**2) - x2 - (x1 * x2)
  print(y)  # 標準出力に出力

Copy link
Collaborator

@yoshipon yoshipon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ごめんなさい遅くなりました.ありがとうございます.

@yoshipon yoshipon merged commit 6493bcc into develop/v2 Jan 20, 2025
10 checks passed
@yoshipon yoshipon deleted the feature/v2--patch--hpo.rst branch January 20, 2025 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants